<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<div id="main">
			用户名：<input id="name" type="text" name="name" /><br/>
			
		</div>
		
		
		<script type="text/javascript">
			//设置属性值
			var inp = document.getElementById("name");
			//设置输入框的默认值为张三
			inp.setAttribute("type","button");
			inp.setAttribute("value","按钮");
			//获取属性值
			alert(inp.getAttribute("type"));
		</script>
	</body>
</html>
